﻿using UnityEngine;
using System.Collections;

public class Enemy1XiaoChu : MonoBehaviour {


	public  GameObject[] obj = new GameObject[2];
	//移动速度
	public float enemy_Speed = 1;
	Transform m_Transform;
	int m_a =0;

	void Start () {
	
		m_Transform = this.transform;
	}

	void Update () {
	
		for(int i=0;i<2;i++)
		{
			if(obj[i]==null)
			{
				m_a++;
			}
		}

		if(m_a>=2)
		{
			Destroy(this.gameObject);
		}
		m_a =0;

		this.UpdataMove();
	}

	void UpdataMove()
	{
		float m_Y = m_Transform.position.y;
		m_Transform.position = new Vector3(m_Transform.position.x,m_Y-=Time.deltaTime*enemy_Speed,0);
	}
}
